########################################
#
#
#
#
#

# scp -P 2001 ~/svn/YContactTranslate/a.log yuzhongmin@172.16.1.97:/opt/webroot/translate.youlianxi.com


config = File.new './scp.config', 'r'
config.readlines.each{
	|line|
	line.strip!
	if (line.length > 0)
		value = line[ line.index('=') + 1 .. -1]
		value.strip!
		if (line.start_with? 'REMOTE_SERVER')
			$server = value
			puts $server
		elsif (line.start_with? 'REMOTE_PORT')
			$port = "-P " + value
		elsif (line.start_with? 'REMOTE_PATH')
			$remote_path = value
		elsif (line.start_with? 'LOCAL_PATH')
			$local_path = value
		end
	end
}
config.close

# Functional
def scp filename
end


# Main
file, *a = ARGV

if file == "."
	# Current Dir
elsif file == "*"
	# All
else
	# The File
	dirname =  File.dirname(file)

	$remote_path = File.join($remote_path, dirname)

	shell = "scp #{$port} #{$local_path}#{file} #{$server}:#{$remote_path}"
	puts shell
	system(shell)
end


